package com.test.servicelmp;

import com.test.bean.User;
import com.test.dao.UserDao;
import com.test.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("UserService")
public class UserServiceImp implements UserService {
    @Autowired
    UserDao userDao;
    @Override
    public User loginUser(String username) {
        return userDao.loginUser(username);
    }

    @Override
    public boolean registerUser(String username, String password) {
        User user = userDao.loginUser(username);
        if(user==null){
            return userDao.registerUser(username,password)!=0;
        }
        return false;
    }
}
